#include <bits/stdc++.h>

#define eb emplace_back
#define ep emplace
#define fi first
#define se second
#define in read<int>()
#define lin read<ll>()
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)

using namespace std;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using vec = vector < int >;
using veg = vector < pii >;

template < typename T > T read() {
	T x = 0; bool f = 0; char ch = getchar();
	while(!isdigit(ch)) f |= ch == '-', ch = getchar();
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = getchar();
	return f ? -x : x;
}

template < typename T > void chkmax(T &x, const T &y) { x = x > y ? x : y; }
template < typename T > void chkmin(T &x, const T &y) { x = x < y ? x : y; }

const int N = 3e5 + 10;
const int V = 3e5 + 10;

int a[N], n;

struct {
	ll tr[V + 10];
	void add(int x, int v) { for(; x <= V; x += x & -x) tr[x] += v; }
	ll query(int x) { if(x < 0) return 0; chkmin(x, V); ll res = 0; for(; x; x -= x & -x) res += tr[x]; return res; }
	ll query(int x, int y) { return query(y) - query(x - 1); }
} t1, t2, t3;
	
int main() {
#ifndef ONLINE_JUDGE
	freopen("1.in", "r", stdin);
#endif
	n = in; rep(i, 1, n) a[i] = in;
	ll ans = 0, tot = 0;
	rep(i, 1, n) {
		ans += 1ll * (i - 1) * a[i] - t3.query(a[i]);
		rep(t, 0, V) {
			if(1ll * t * a[i] > V) break;
			ans += t2.query(t * a[i], (t + 1) * a[i] - 1) - t1.query(t * a[i], (t + 1) * a[i] - 1) * t * a[i];
			t3.add(max(t * a[i], 1), t * a[i]); t3.add((t + 1) * a[i], -t * a[i]);
		}
		t1.add(a[i], 1); t2.add(a[i], a[i]); tot += a[i];
		printf("%lld ", ans);
	}
	return 0;
}
